<div class="articlemodule">
{include file="`$smarty.const.BASE`modules/common/views/_permission_icons.tpl"}
<h1>{$moduletitle}</h1>
<br>
<table cellspacing="0" cellpadding="0" style="border:none; "  width=100% >
{foreach name=c from=$data key=catid item=articles}
{if $hasCategories != 0}
{/if}
{foreach name=a from=$articles item=article}
{assign var=article_found value=0}
	{math equation="x+1" x=$article->rank assign=prev}
	{math equation="x-1" x=$article->rank assign=next}
<tr>
	<td style="padding-top: 10px;" class="">
	   {* Article header *}
	     <a id="article_{$article->id}" class="article_title_link" title="{$article->title}" href="{link action=view_article id=$article->id src=$host_source}" >{$article->title}</a>
       
	</td>
	<td align="right">
			<a href="{link action=view_article id=$article->id printerfriendly=1}" target=_blank title="{$_TR.print}" alt="{$_TR.print}" onclick="" rel="nofollow"><img src="{$smarty.const.THEME_RELATIVE}images/printBut.png"  /></a>
	<span>
	{if $permissions.manage == 1}
	
		<a href="{link action=edit_article id=$article->id}" title="{$_TR.alt_edit}">
			<img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}edit.png" title="{$_TR.alt_edit}" alt="{$_TR.alt_edit}" /></a>
		<a href="{link action=delete_article id=$article->id}" title="{$_TR.alt_delete}" onclick="return confirm('{$_TR.delete_confirm}');">
			<img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}delete.png" title="{$_TR.alt_delete}" alt="{$_TR.alt_delete}" /></a>	
		{if $smarty.foreach.a.first == 0}
		<a href="{link action=rank_switch a=$article->rank b=$prev id=$article->id category_id=$article->category_id}">			
			<img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}up.png" title="{$_TR.alt_up}" alt="{$_TR.alt_up}" /></a>
		{else}
		<img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}up.disabled.png" title="{$_TR.alt_up_disabled}" alt="{$_TR.alt_up_disabled}" />
		{/if}
		
		{if $smarty.foreach.a.last == 0}
		<a href="{link action=rank_switch a=$next b=$article->rank id=$article->id category_id=$article->category_id}">
			<img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}down.png" title="{$_TR.alt_down}" alt="{$_TR.alt_down}" /></a>
		{else}
		<img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}down.disabled.png" title="{$_TR.alt_down_disabled}" alt="{$_TR.alt_down_disabled}" />
		{/if}		
	{/if}
	</td>
</tr>
<tr>
  <td colspan=2 style="padding-left: 0px; padding-bottom: 0px; padding-top: 0px;">
    <div class="article-tools clearfix">
			<div class="article-meta">
				<span class="createdate">&nbsp;&nbsp;&nbsp;&nbsp;{$article->create_date}</span>&nbsp;&nbsp;&nbsp;&nbsp;
				<span class="createby">{$article->username}</span>
				<span class="readcount">{$_TR.readcount}&nbsp;{$article->readcount}&nbsp;{$_TR.readcount_suffix}</span>
			</div>
		</div>
  </td>
</tr>
<tr>
	<td style="padding-left:0;" class="article_summary" colspan="2">
	  {* Article body *}
	{if $article->image_path != ""}
    <img class="caption" src="{$smarty.const.BASE_URL}/phpThumb.php?src={$article->image_path}&w=120&h=120" border="1" align="left" style="padding: 1px; margin-right: 6px;" />
    {/if}
			<div ><img src="{$smarty.const.THEME_RELATIVE}images/quote.gif" border=0>
			 {$article->body|summarize:'html':'para'}
      </div>
    <div align=right>
    <img src="{$smarty.const.THEME_RELATIVE}images/bullet-r.gif" border=0>
    <a id="article_more_{$article->id}" href="{link action=view_article id=$article->id module=articlemodule src=$host_source}" class="">{$_TR.read_more}</a>
    {if $article->file_id >0}
    &nbsp; <img src="{$smarty.const.THEME_RELATIVE}images/bullet-r.gif" border=0>
    <a href="download_file.php?id={$article->file_id}" class="" target=_blank>{$_TR.download}</a>
    {/if}
    </div>
    {if $smarty.foreach.c.first == 0}
      {if $smarty.foreach.c.last == 0}
        <span class="article_separator">&nbsp;</span>
      {/if}
    {/if}
	</td>
</tr>

{assign var=article_found value=1}
{foreachelse}
{ if ($config->enable_categories == 1 && $catid != 0) || ($config->enable_categories==0)}
<tr>
	<td align="center"><i>{$_TR.no_article}</i></td>
</tr>
{/if}
{/foreach}
{foreachelse}
{/foreach}
</table>
{* for pagination *}
{if count($pages) > 1}
<div class="article_pagination_div">
  <b><i>{$_TR.page}</i></b>&nbsp;
  {foreach from=$pages key=pageid item=page_item}
    <a href="{if $pageid == $page}#{else}{link action=view_page page=$pageid}{/if}">{$page_item}</a>&nbsp;
  {/foreach}
</div>
{/if}
{* end pagination *}
{if $permissions.manage == 1}
	{if $submissions > 0}<a href="{link action=view_submissions}">You have {$submissions} submitted article{if $submissions > 1}s{/if}</a>{/if}
	<br /><a href="{link module=articlemodule action=edit_article src=$host_source}">{$_TR.new_entry}</a><br />
	{if $config->enable_categories == 1}
		<a href="{link module=categories action=manage orig_module=articlemodule}">{$_TR.manage_categories}</a>
	{/if}
{/if}

{if $config->allow_submissions == 1}
	{get_user assign=user}
	{if $config->require_login == 0 || $user->id > 0}
		<br><a href="{link action=submit_article}">Submit an Article</a>
	{/if}
{/if}
</div>
{* build up the fancybox 
    {literal}
       <script language=javascript>
        $(document).ready(function() {
        {/literal}
          {foreach name=c from=$data key=catid item=articles}
          {foreach name=a from=$articles item=article} 
          $("a#article_{$article->id}{literal}").fancybox({ 
            'hideOnContentClick': false,
            'zoomOpacity': true,
            'overlayShow': false,
            'overlayOpacity': 0.9,
            'frameHeight': 580,
            'autoDimensions' : false,
            'width': 800,
            'height': 580,
            'zoomSpeedIn'			: 600,
        		'zoomSpeedOut'			: 500,
		        'easingIn'				: 'easeOutBack',
		        'easingOut'				: 'easeInBack'
		   {/literal}
		   {if $article->background_path != ''}
				, 'fancy_background'				: '{$article->background_path}'
		   {/if}
		   {literal}
          });{/literal}
          $("a#article_more_{$article->id}{literal}").fancybox({ 
            'hideOnContentClick': false,
            'zoomOpacity': true,
            'overlayShow': true,
            'autoDimensions' : false,
            'overlayOpacity': 0.9,
            'height': 580,
            'width': 800,
            'zoomSpeedIn'			: 600,
        		'zoomSpeedOut'			: 500,
		        'easingIn'				: 'easeOutBack',
		        'easingOut'				: 'easeInBack'
		     {/literal}
		   {if $article->background_path != ''}
				, 'fancy_background'				: '{$article->background_path}'
		   {/if}
		   {literal}   
          });
          {/literal}
          {/foreach}{/foreach}
          }); 
        </script>
*}
